package model;

public class Configuration {
	
	private final String input;
	private int position;
	private State state;
	private final Automaton automaton;
	private TreeElement latestOutput;
	
	public Configuration(final Automaton automaton, final State state, final String input, final int position) {
		this.automaton = automaton;
		this.state = state;
		this.input = input;
		this.position = position;
		this.latestOutput = new EmptyTreeElement();
		
	}

	public String getInput() {
		return input;
	}

	public int getPosition() {
		return position;
	}
	public void setPosition(final int position){
		this.position = position;
	}

	public State getState() {
		return state;
	}
	public void setState(final State state){
		this.state = state;
	}

	public Automaton getAutomaton() {
		return automaton;
	}
	
	public char getCurrentChar(){
		if(this.hasInputLeft()){
			return this.getInput().charAt(getPosition());
		}
		throw new Error("No inputcharacter left");
		
	}

	private boolean hasInputLeft() {
		return this.input.length()>this.position;
	}

	public TreeElement getLatestOutput() {
		return latestOutput;
	}
	public void setLatestOutput(final StringTreeElement latestOutput) {
		this.latestOutput = latestOutput;
	}
	
}
